/*************************************************
  Copyright (C), 2007-2099,SZ-STREAMING Tech. Co., Ltd.
  File name:
  Author:
  Date:
  Description:
*************************************************/
#ifndef __RECORDFILEHEADER_H__
#define __RECORDFILEHEADER_H__

namespace record
{

#define	RHT_CHAR	char
#define	RHT_BYTE	unsigned char
#define	RHT_INT32	int
#define	RHT_UINT32	unsigned long
#define	RHT_UINT16	unsigned short
#define	RHT_BOOL	bool
#define	RHT_TRUE	true
#define	RHT_FALSE	false

struct _RMVIDEO_STHDR_
{
	RHT_CHAR	struct_attribute[4];
	RHT_UINT32	struct_size;
};

struct _RMVIDEO_AUDIO_
{
	RHT_BYTE			chlCount;
	RHT_BYTE			sampleBits;
	RHT_CHAR		reserved1[2];
	RHT_UINT32		bitRate;
	RHT_UINT32		sampleRate;
};

struct _RMVIDEO_FILEHEADER_
{
	_RMVIDEO_STHDR_	hdr;
	RHT_CHAR		verDev[28];
	RHT_BYTE			verFile;
	RHT_BYTE			begYear;
	RHT_BYTE			begMonth;
	RHT_BYTE			begDay;
	RHT_BYTE			begHour;
	RHT_BYTE			begMinute;
	RHT_BYTE			begSecond;
	RHT_BYTE			endYear;
	RHT_BYTE			endMonth;
	RHT_BYTE			endDay;
	RHT_BYTE			endHour;
	RHT_BYTE			endMinute;
	RHT_BYTE			endSecond;
	RHT_BYTE			chlCount;
	RHT_BYTE			recordType;
	RHT_BYTE			fileProtected;
	RHT_BYTE			recordMode;
	RHT_BYTE			videoType;
	RHT_UINT16		devNo;
	_RMVIDEO_AUDIO_	audio;
	RHT_UINT32		lIndexTableOffset;
	RHT_UINT32		ulHeadLen;
	RHT_UINT16		usdevType;
	RHT_BYTE		cDevBootMode:4;
	RHT_BYTE		cDevShutMode:4;
	RHT_BYTE			dateShowFmt;
	RHT_CHAR		szdevType[12];
};

struct _RMVIDEO_CHLHEADER_
{
	_RMVIDEO_STHDR_	hdr;
	RHT_BYTE			chlIndex;
	RHT_BYTE			frameRate;
	RHT_BYTE			resolution;
	RHT_CHAR		reserved1;
	RHT_CHAR		chlName[16];
};
struct _RMVIDEO_CHLDVRP_
{
	RHT_BYTE			recover;
	RHT_BYTE			pointLeft;
	RHT_BYTE			pointTop;
	RHT_BYTE			pointRight;
	RHT_BYTE			pointBottom;
	RHT_CHAR		reserved1[3];
	RHT_CHAR		reserved2[4];
};

struct _RMVIDEO_CHLM8P_
{
	RHT_BYTE			clockinsert;
	RHT_CHAR		reserved1[3];
	RHT_CHAR		reserved2[8];
};

struct _RMVIDEO_CHANNEL_
{
	_RMVIDEO_CHLHEADER_	chlHeader;
	union RMVIDEO_CHLSP
	{
		RHT_CHAR 		reserved[12];
		_RMVIDEO_CHLDVRP_	dvrchlp;
		_RMVIDEO_CHLM8P_	mdvrm8;
	}uchlsp;
};

struct _RMVIDEO_CHLPARS_
{
	_RMVIDEO_CHANNEL_ channel[4];
};

struct _RMVIDEO_SMDVR_
{
	_RMVIDEO_STHDR_	hdr;
	RHT_CHAR		senor_name[9][8];
	RHT_CHAR		md_name[8];
	RHT_CHAR		speeding_name[2][8];
	RHT_CHAR		company_name[16];
	RHT_CHAR		vehicle_ID[16];
	RHT_CHAR		driver_name[16];
	RHT_CHAR		 sensor_short_name[9][2];
 	RHT_CHAR		 reserved[2];
};

union _RMVIDEO_PAREX_
{
	RHT_CHAR 		reserved[188];
	_RMVIDEO_SMDVR_	mdvr;
};

struct _RMVIDEO_CHAUDIO_
{
	 unsigned char cChlIndex;
 	unsigned char cAudioChannels:3;
 	unsigned char cSampleBits:5;
 	unsigned char reserved[2];
 	unsigned long lSampleRate;
};

struct _RMVIDEO_FILEHEADEREX_
{
	_RMVIDEO_STHDR_  hdr;
	unsigned long   ulPrevRecodSecond;
	_RMVIDEO_CHAUDIO_ stuAudio[4];
	char     reserved[12];
};

struct _RMVIDO_VSIZE_CHL_
{
	unsigned short usVideoWidth;
	unsigned short usVideoHeight;
};

struct _RMVIDEO_VIDEO_SIZE_
{
	_RMVIDO_VSIZE_CHL_ stuVSize[4];
};

typedef struct _RMVIDEO_HEADER_{
	_RMVIDEO_FILEHEADER_		fileHdr;
	_RMVIDEO_CHLPARS_		chlPars;
	_RMVIDEO_PAREX_			parEx;  //该结构体缩小16个字节,将这16个字节定义为_RMVIDEO_VIDEO_SIZE_,添加于2011.8.24
	_RMVIDEO_VIDEO_SIZE_ 	stuVideoSize;
	_RMVIDEO_FILEHEADEREX_	fileHdrEx;
}rmvideoheader_t;

} // end namespace record

#endif/*__RECORDFILEHEADER_H__*/

